package com.castle.fortress.admin.form.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 数据库查询条件
 * @author  castle
 */
@Getter
@AllArgsConstructor
public enum DbQueryEnum {

    EQ(1,"=","相等"),
    LT(2,"<","小于"),
    LT_EQ(3,"<=","小于等于"),
    GT(4,">","大于"),
    GT_EQ(5,">=","大于等于"),
    UN_EQ(6,"!=","不等于"),
    LIKE(7,"like","模糊匹配"),
    BETWEEN(8,"between","介于..之间"),
    ;

    Integer code;
    String name;
    String desc;

    public static String getNameByCode(Integer code){
        for(DbQueryEnum e:DbQueryEnum.values()){
            if(e.getCode().equals(code)){
                return e.getName();
            }
        }
        return null;
    }
}
